<template>
  <div class="search">
    <f-form ref="form" :action="api.afterService" :form-key="this.formItem.afterServiceId">
      <f-form-item label="服务单号" name="serviceNo" :required="true" :value="formItem.serviceNo"/>
      <f-form-item label="售后类别" name="serviceType" :required="true" type="select" data-type="number" :data="api.afterService.serviceType" :value="formItem.serviceType"/>
      <f-form-item label="申请原因" name="causeId" :required="true" type="select" :data="api.cause.list" :value="formItem.causeId" value-key="returnCauseId" label-key="returnCauseTitle"/>
      <f-form-item label="申请描述" name="serviceDesc" :value="formItem.serviceDesc"/>
      <f-form-item label="客户上传图片" type="upload" name="serviceImages" :value="formItem.serviceImages"/>

      <f-form-item label="审核状态" name="serviceState" :required="true" type="radio" v-if="loaded"   :data="api.common.authState" :value.sync="formItem.serviceState"/>

    </f-form>
  </div>
</template>

<script>
  export default {
    name: 'AfterServiceForm',
    props: {},
    data() {
      return {
        isAdd: true,
        loaded: false,
        formItem: this.getFormItem()
      }
    },
    computed: {},
    methods: {
      getFormItem() {
        return {
          brandSite: ''
        }
      },
      setData(data) {
        this.isAdd = true
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.afterServiceId) {
          this.formItem = data
          this.isAdd = false
        } else {
          this.loaded = true
        }

      },
      handleSubmit(callback) {
        this.$refs.form.submit({},callback)
      }
    },
    created() {

    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
